package com.just.agentweb

import android.content.Context
import android.util.Log
import com.tencent.smtt.export.external.TbsCoreSettings
import com.tencent.smtt.sdk.QbSdk


object QbSDK {
    fun init(context: Context, withOutWifi: Boolean = true) {
        QbSdk.setDownloadWithoutWifi(withOutWifi)

        val map: HashMap<String, Any> = HashMap()
        map[TbsCoreSettings.TBS_SETTINGS_USE_SPEEDY_CLASSLOADER] = true
        map[TbsCoreSettings.TBS_SETTINGS_USE_DEXLOADER_SERVICE] = true
        QbSdk.initTbsSettings(map)

        QbSdk.initX5Environment(context, object : QbSdk.PreInitCallback {
            override fun onCoreInitFinished() {
                Log.d("QbSDK", "onCoreInitFinished")
            }

            override fun onViewInitFinished(p0: Boolean) {
                Log.d("QbSDK", "onViewInitFinished:$p0")
            }
        })
    }
}